#include <unistd.h>
#include <stdio.h>

int main() {
    printf("I will fork in 5 seconds.\n");
    sleep(5);
    int pid = fork();
    if(pid == -1) {
        printf("fork error!\n");
        return 1;
    }
    if(pid) {
        printf("[fork->pid=%d] I am father, my pid is %d\n.", pid, getpid());
        sleep(5);
        return 0;
    } else {
        printf("[fork->pid=%d] I am child, my pid is %d\n.", pid, getpid());
        sleep(5);
        return 0;
    }
}

